# Contributor: rubicon <rubicon@mailo.com>
# Maintainer: rubicon <rubicon@mailo.com>
pkgname=txr
pkgver=278
pkgrel=0
pkgdesc="Programming language for convenient data munging"
url="https://www.nongnu.org/txr/"
# s390x: ftbfs (struct jmp in unwind.h not ported)
# armhf: runtime error (open-subprocess used with non-string arg)
# armv7: core dumped (while compiling stdlib/cadr.tl)
# riscv64: ftbfs
arch="all !s390x !armv7 !armhf !riscv64"
license="BSD-2-Clause"
makedepends="libffi-dev zlib-dev"
subpackages="$pkgname-doc $pkgname-vim::noarch"
source="https://www.kylheku.com/cgit/txr/snapshot/txr-$pkgver.tar.gz"

build() {
	./configure --prefix=/usr
	make
}

check() {
	case $CARCH in
	aarch64)
		msg "Disabling IPv6 test for aarch64 in 014/dgram-stream.tl"
		sed -i 's/,\*maybe-ipv6//' tests/014/dgram-stream.tl
		;;
	esac

	make tests
}

package() {
	make DESTDIR="$pkgdir" install
}

vim() {
	pkgdesc="Vim syntax for $pkgname"
	depends=""
	install_if="$pkgname=$pkgver-r$pkgrel vim"

	install -Dvm644 "$builddir"/*.vim \
		-t "$subpkgdir"/usr/share/vim/vimfiles/syntax/
}

sha512sums="
7e2647d0139da09f28dde7481d9f9e214bcc846cac0815682546fb9a7663d55949263807b77714b49a817f1663914a50afedaa6d880af42cb0235742f25bfea4  txr-278.tar.gz
"
